package com.zsc.oj.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zsc.oj.model.dto.tbComment.TbCommentQueryRequest;
import com.zsc.oj.model.entity.TbComment;
import com.zsc.oj.model.vo.TbCommentVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 评论服务
 *
 * @author <a href="https://github.com/liyupi">程序员鱼皮</a>
 * @from <a href="https://www.code-nav.cn">编程导航学习圈</a>
 */
public interface TbCommentService extends IService<TbComment> {

    /**
     * 校验数据
     *
     * @param tbComment
     * @param add 对创建的数据进行校验
     */
    void validTbComment(TbComment tbComment, boolean add);

    /**
     * 获取查询条件
     *
     * @param tbCommentQueryRequest
     * @return
     */
    QueryWrapper<TbComment> getQueryWrapper(TbCommentQueryRequest tbCommentQueryRequest);
    
    /**
     * 获取评论封装
     *
     * @param tbComment
     * @param request
     * @return
     */
    TbCommentVO getTbCommentVO(TbComment tbComment, HttpServletRequest request);

    /**
     * 分页获取评论封装
     *
     * @param tbCommentPage
     * @param request
     * @return
     */
    Page<TbCommentVO> getTbCommentVOPage(Page<TbComment> tbCommentPage, HttpServletRequest request);
}
